﻿<%@ Page Title="Unit Management" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="UnitManagement.aspx.cs" Inherits="PepsiCo.UI.UnitManagement" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="ContentCSS" ContentPlaceHolderID="CssContent" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ScriptContent" runat="Server">
    <script src="Scripts/pepsico-script/pepsico-script.js" type="text/javascript"></script>
    <script type="text/javascript">
        function onClientContextItemClicking(sender, args) {
            var menuItem = args.get_menuItem();
            var treeNode = args.get_node();
            menuItem.get_menu().hide();
            switch (menuItem.get_value()) {
                case "Delete":
                    var result = confirm("Do you want delete unit: " + treeNode.get_text() + "?");
                    args.set_cancel(!result)
                    break;
            }
        }

        function CheckAllItem(checked) {
            var table = $("#tbSales");
            $('td input:checkbox', table).prop('checked', checked);
        }

        function GetStaff(staffId) {
            var unitId = $("#<%=hdfTreeID.ClientID%>").val();
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/StaffGetById",
                data: "{'staffId':" + JSON.stringify(staffId) + ", 'unitId':" + JSON.stringify(unitId) + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#unitId").val(data.d.UnitID);
                    $("#staffId").val(data.d.StaffID);
                    $("#staffcode").val(data.d.StaffCode);
                    $("#name").val(data.d.StaffName);
                    $("#address").val(data.d.Address);
                    //split phone number
                    if (data.d.PhoneNumber != null && data.d.PhoneNumber.length > 0) {
                        var phonelist = data.d.PhoneNumber.split(",");
                        $("#phonenumber").val(phonelist[1].substring(0, phonelist[1].indexOf(":")));
                        for (var i = 2; i < phonelist.length; i++) {
                            AddedPhoneNumber($("#phonenumber"), phonelist[i].substring(0, phonelist[i].indexOf(":")));
                        }
                    }
                    SetSelectedValue("#gender", data.d.Gender);
                    SetSelectedValue("#<%=ddlUnit.ClientID%>", data.d.UnitID);
                    SetSelectedValue("#drdLevel", data.d.StaffLevel);
                    SetSelectedValue("#<%=drdType.ClientID%>", data.d.StaffTypeID);
                    SetSelectedValue("#drdStatus", data.d.Actived);
                }
            });
        }

        function SetSelectedValue(control, value) {
            $("option[value='" + value + "']", control).prop("selected", "selected");
        }

        function UpdateStaff(staffId, unitId, staffcode, staffname, gender, address, stafflevel, stafftype, actived, phonenumber) {
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/StaffUpdate",
                data: "{" +
                    "'staffId':" + JSON.stringify(staffId) + "," +
                    "'unitId':" + JSON.stringify(unitId) + "," +
                    "'staffcode':" + JSON.stringify(staffcode) + "," +
                    "'staffname':" + JSON.stringify(staffname) + "," +
                    "'gender':" + JSON.stringify(gender) + "," +
                    "'address':" + JSON.stringify(address) + "," +
                    "'stafflevel':" + JSON.stringify(stafflevel) + "," +
                    "'stafftype':" + JSON.stringify(stafftype) + "," +
                    "'actived':" + JSON.stringify(actived) + "," +
                    "'phonenumber':" + JSON.stringify(phonenumber) +
                    "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    UpdatePanel($("#tbSales tbody"));
                },
                error: function (msg) {
                    var err = eval("(" + msg.responseText + ")");
                    alert(err.Message);
                }
            });
        }

        function InsertStaff(staffcode, staffname, gender, address, phonenumber, stafflevel, stafftype, actived, unitId) {
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/StaffInsert",
                data: "{" +
                    "'staffcode':" + JSON.stringify(staffcode) + "," +
                    "'staffname':" + JSON.stringify(staffname) + "," +
                    "'gender':" + JSON.stringify(gender) + "," +
                    "'address':" + JSON.stringify(address) + "," +
                    "'phonenumber':" + JSON.stringify(phonenumber) + "," +
                    "'stafflevel':" + JSON.stringify(stafflevel) + "," +
                    "'stafftype':" + JSON.stringify(stafftype) + "," +
                    "'actived':" + JSON.stringify(actived) + "," +
                    "'unitId':" + JSON.stringify(unitId) +
                    "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    UpdatePanel($("#tbSales tbody"));
                },
                error: function () {
                    alert('An error occursed');
                }
            });
        }

        function DeleteStaff(staffId, unitId) {
            if (confirm("Do you want delete this item?") == false) return false;
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/StaffDeleteById",
                data: "{'staffId':" + JSON.stringify(staffId) + ", 'unitId':" + JSON.stringify(unitId) + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#tbSales tbody").find("input[value='" + staffId + "']").closest("tr").remove();
                },
                error: function (msg) {
                    alert("An ocurred when delete!");
                }
            });
        }

        function DeleteSelectedItem() {
            var tbody = $("#tbSales tbody");
            var length = tbody.find("input:checked").length;
            if (length == 0) {
                return false;
            }
            else {
                if (confirm("Do you want delete selected item?")) {
                    var array = "";
                    tbody.find("input:checked").each(function () {
                        array += "," + $(this).val();
                    });
                    $.ajax({
                        type: "POST",
                        url: "UnitManagement.aspx/SaleDeleByListOfId",
                        data: "{'ids':" + JSON.stringify(array) + "}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (data) {
                            $("#tbSales tbody").find("input:checked").parent().parent().remove();
                        },
                        error: function (msg) {
                            alert("An ocurred when delete!");
                        }
                    });
                }
            }
        }

        function UpdatePanel(panelToUpdate) {
            var unitId = $("#<%=hdfTreeID.ClientID%>").val();
            var curentPage = $(".pagging").find("a").filter(".aspNetDisabled.current01").html();
            if (curentPage == null) curentPage = 1;
            var pageSize = $("#<%=ddlSortable_length.ClientID%>").val();
            var totalRecord = 0;
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/StaffGetByUnitId",
                data: "{'unitId':" + JSON.stringify(unitId) + "," +
                      "'curentPage':" + JSON.stringify(curentPage) + "," +
                      "'pageSize':" + JSON.stringify(pageSize) +
                      "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    //Update panel
                    panelToUpdate.find("tr").remove();
                    for (var i = 0; i < data.d.length; i++) {
                        var html = "<tr>" +
                                "<td align='center'>" +
                                "    <input type='checkbox' value='" + data.d[i].StaffID + "' />" +
                                "</td>" +
                                "<td>" + data.d[i].StaffCode + "</td>" +
                                "<td>" + data.d[i].StaffName + "</td>" +
                                "<td>" + data.d[i].Address + "</td>" +
                                "<td>" + data.d[i].StaffLevel + "</td>" +
                                "<td>" + data.d[i].StaffType + "</td>" +
                                "<td>" + data.d[i].UnitName + "</td>" +
                                "<td style='text-align: center'>" +
                                "    <input type='image' value='" + data.d[i].StaffID + "' src='images/i_edit.gif' title='Edit sale'" +
                                "        onclick=\"GetStaff(this.value); $('#checkAdd').val('edit'); showdialog(); return false;\" />" +
                                "    &nbsp;&nbsp;" +
                                "    <input type='image' value='" + data.d[i].StaffID + "' src='images/i_delete.gif' title='Delete sale'" +
                                "        onclick=\"DeleteStaff(this.value,$('#<%=hdfTreeID.ClientID%>').val()); return false;\" />" +
                                "</td>" +
                            "</tr>";
                        panelToUpdate.append(html);
                    }
                }
            });
        }

        function dialog() {
            $("#dialog-form").dialog({
                autoOpen: false,
                width: 450,
                modal: true,
                buttons: {
                    " OK ": function () {
                        var curUnitId = "<%=CurUser.UnitID%>";
                        var checkAdd = $("#checkAdd").val();
                        var staffId = $("#staffId").val();
                        var unitId = $("#<%=ddlUnit.ClientID%>").val();
                        //
                        var staffname = $("#name").val();
                        var staffcode = $("#staffcode").val();
                        var gender = $("#gender").val();
                        var address = $("#address").val();
                        var stafflevel = $("#drdLevel").val();
                        var stafftype = $("#<%=drdType.ClientID%>").val();
                        var actived = $("#drdStatus").val();
                        var phonenumber = $("#phonenumber").val();
                        $("#dialog-form").find("input[name=AddedPhonenumber]").each(function () {
                            phonenumber += "," + $(this).val();
                        });
                        //CheckFullInfo
                        if (!CheckFullInfo()) {
                            $("#errorMessage").html($("#checkfullinfo").val());
                            return false;
                        }
                        //Validate phone number
                        if (!ValidatePhoneNumber(phonenumber)) {
                            $("#errorMessage").html("Phone number is invalid!");
                            return false;
                        }               
                        //Check privilege Unit
                        if (!checkPrivileges(curUnitId, unitId)) {
                            $("#errorMessage").html("This unit do not belong to your permissions!");
                            return false;
                        }
                        //Check exists staff code
                        var exists = true;
                        if (checkAdd == "edit")
                            exists = CheckExistsStaffCode(staffId, staffcode);
                        else if (checkAdd == "add")
                            exists = CheckExistsStaffCode(null, staffcode);
                        if (!exists) {
                            if (checkAdd == "edit") {
                                //thực hiện cập nhật vào cơ sở dữ liệu
                                UpdateStaff(staffId, unitId, staffcode, staffname, gender, address, stafflevel, stafftype, actived, phonenumber);
                            } else if (checkAdd == "add") {
                                //thực hiện thêm mới vào csdl
                                InsertStaff(staffcode, staffname, gender, address, phonenumber, stafflevel, stafftype, actived, unitId);
                            }
                            $(this).dialog("close");
                        }
                        else {
                            $("#errorMessage").html("Staff code has allready exists!");
                        }
                    },
                    Cancel: function () {
                        $(this).dialog("close");
                    }
                },
                close: function () {
                    var allFields = $("#dialog-form input, #dialog-form textarea, #dialog-form select ");
                    allFields.val("").removeClass("ui-state-error");
                    $("#dialog-form #errorMessage").html("");
                    $("#dialog-form").find("input[name=AddedPhonenumber]").closest("tr").remove();
                }
            });
        }

        function showdialog() {
            $("#dialog-form").dialog("open")
        }

        $(document).ready(function () {
            dialog();
            $('#tbSales tbody tr:odd').addClass('odd');
            $('#tbSales tbody tr').hover(function () {
                $(this).addClass('hover');
            }, function () {
                $(this).removeClass('hover');
            });
        });

        function AddedPhoneNumber(obj, val) {
            var html =
           "<tr> " +
           "    <td> " +
           "        Phone number " +
           "    </td> " +
           "    <td> " +
           "        <input type='text' name='AddedPhonenumber' value='" + val + "' onkeypress='return ValidateKeypress(/\\d/,event);' /> " +
           "    </td> " +
           "    <td style='width:40px'> " +
           "        <input type='button' title='Remover phone number' class='ui-button' " +
           "            style='margin: 0 0 8px 8px;' onclick='btnRemovePhoneNumber_Click(this);'/> " +
           "    </td> " +
           "</tr> ";
            $(obj).closest("tr").after(html);
        }

        function btnRemovePhoneNumber_Click(obj) {
            $(obj).closest("tr").remove();
        }

        function CheckFullInfo() {
            if ($.trim($("#staffcode").val()) == "") {
                $("#checkfullinfo").val("staff code not allow null!");
                return false;
            }
            if ($.trim($("#name").val()) == "") {
                $("#checkfullinfo").val("staff name not allow null!");
                return false;
            }
            if ($.trim($("#address").val()) == "") {
                $("#checkfullinfo").val("address not allow null!");
                return false;
            }
            if ($.trim($("#gender").val()) == "") {
                $("#checkfullinfo").val("gender not allow null!");
                return false;
            }
            if ($.trim($("#phonenumber").val()) == "") {
                $("#checkfullinfo").val("phonenumber not allow null!");
                return false;
            }
            return true;
        }

        function checkPrivileges(unit1ID, unit2ID) {
            var result = false;
            $.ajax({
                type: "POST",
                url: "UnitManagement.aspx/checkPrivileges",
                data: "{'unit1ID':" + JSON.stringify(unit1ID) + ", 'unit2ID':" + JSON.stringify(unit2ID) + "}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                async: false,
                success: function (data) {
                    result = data.d;
                },
                error: function (msg) {
                    result = false;
                }
            });
            return result;
        }
    </script>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="Server">
    <div id="telerikAjax" style="visibility: hidden">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTreeView">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView" />
                        <telerik:AjaxUpdatedControl ControlID="lblMsg1" />
                        <telerik:AjaxUpdatedControl ControlID="CtrEdit" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="CtrEdit">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="CtrEdit" />
                        <telerik:AjaxUpdatedControl ControlID="RadTreeView" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
    </div>
    <div class="row-fluid">
        <div class="span4">
            <div class="head">
                <div class="isw-list">
                </div>
                <h1>
                    Unit System</h1>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid ui-corner-all" style="overflow: auto; padding: 10px">
                <telerik:RadTreeView ID="RadTreeView" runat="server" OnClientContextMenuItemClicking="onClientContextItemClicking"
                    OnContextMenuItemClick="RadTreeView_ContextItemClick" Skin="WebBlue" Font-Size="12px"
                    Font-Names="Arial" OnNodeClick="RadTreeView_NodeClick">
                    <CollapseAnimation Duration="100" Type="InQuint" />
                    <ContextMenus>
                        <telerik:RadTreeViewContextMenu Skin="WebBlue">
                            <Items>
                                <telerik:RadMenuItem runat="server" Font-Size="13px" ImageUrl="~/images/i_add.gif"
                                    Text="Add new" Value="Add">
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem runat="server" Font-Size="13px" ImageUrl="~/images/i_delete.gif"
                                    Text="Delete" Value="Delete">
                                </telerik:RadMenuItem>
                            </Items>
                            <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                        </telerik:RadTreeViewContextMenu>
                    </ContextMenus>
                    <ExpandAnimation Duration="300" />
                </telerik:RadTreeView>
            </div>
        </div>
        <asp:Panel ID="CtrEdit" CssClass="span8" Visible="false" runat="server" Style="margin-left: 1%">
            <div class="head">
                <div class="isw-list">
                </div>
                <h1>
                    Unit details</h1>
                <asp:HiddenField ID="hdfTreeID" Value="" runat="server" />
                <input type="hidden" id="checkAdd" value="add" />
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid" style="padding: 10px">
                <table border="0" cellpadding="2" cellspacing="2" width="100%" style="border-collapse: collapse">
                    <tr>
                        <td>
                            Unit Name:
                        </td>
                        <td>
                            <asp:TextBox ID="txtUnitName" runat="server" CssClass="inputText"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Parent Unit:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlParentUnit" runat="server" CssClass="inputText" AutoPostBack="True">
                            </asp:DropDownList>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Zone:
                        </td>
                        <td>
                            <asp:TextBox ID="txtZone" MaxLength="250" runat="server" CssClass="inputText"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Order
                        </td>
                        <td>
                            <asp:TextBox ID="txtOrder" runat="server" onkeypress="return ValidateKeypress(/\d/,event);" />
                        </td>
                        <td style="padding-bottom: 8px; padding-left: 12px">
                            <asp:Button ID="btnSave" CssClass="btn" runat="server" ValidationGroup="Error" OnClick="btnSave_Click" />
                            <asp:Button ID="btnCancel" CssClass="btn" runat="server" Text="Cancel" OnClick="btnCancel_Click" />
                            <asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" OnClick="btnClose_Click" />
                        </td>
                    </tr>
                </table>
                <div class="dr">
                    <span></span>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span12">
                    <div class="head">
                        <div class="isw-grid">
                        </div>
                        <h1>
                            List of staff</h1>
                        <ul class="buttons">
                            <li><a class="isw-plus" title="Add new" onclick='SetSelectedValue($("#<%=ddlUnit.ClientID%>"), $("#<%=hdfTreeID.ClientID%>").val()); $("#checkAdd").val("add"); showdialog();'
                                href="#"></a></li>
                            <li><a class="isw-minus" title="Delete" onclick="DeleteSelectedItem(); return false;"
                                href="#"></a></li>
                        </ul>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="block-fluid table-sorting">
                        <div role="grid" class="dataTables_wrapper" id="tSortable_wrapper">
                            <div class="dataTables_length">
                                <label>
                                    Show
                                    <asp:DropDownList ID="ddlSortable_length" size="1" aria-controls="tSortable" runat="server"
                                        AutoPostBack="true" OnSelectedIndexChanged="ddlSortable_length_SelectedIndexChanged">
                                        <asp:ListItem Value="5">5</asp:ListItem>
                                        <asp:ListItem Value="10">10</asp:ListItem>
                                        <asp:ListItem Value="25">25</asp:ListItem>
                                        <asp:ListItem Value="50" Selected="True">50</asp:ListItem>
                                        <asp:ListItem Value="100">100</asp:ListItem>
                                    </asp:DropDownList>
                                    entries</label>
                            </div>
                            <div>
                                <uc1:ucPaging ID="pagingtop" runat="server" />
                            </div>
                            <table width="100%" cellspacing="0" cellpadding="0" class="table" id="tbSales">
                                <thead>
                                    <tr>
                                        <th style="width: 20px">
                                            <input type="checkbox" id="chkCheckAll" onclick="CheckAllItem(this.checked)" />
                                        </th>
                                        <th style="width: 100px">
                                            Staff Code
                                        </th>
                                        <th>
                                            Staff Name
                                        </th>
                                        <th>
                                            Address
                                        </th>
                                        <th>
                                            Level
                                        </th>
                                        <th>
                                            Staff Type
                                        </th>
                                        <th>
                                            Unit Name
                                        </th>
                                        <th style="width: 57px">
                                            Action
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <asp:Repeater ID="rptStaff" runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td align="center">
                                                    <input type="checkbox" value='<%#Eval("StaffID")%>' />
                                                </td>
                                                <td>
                                                    <%#Eval("StaffCode") %>
                                                </td>
                                                <td>
                                                    <%#Eval("StaffName") %>
                                                </td>
                                                <td>
                                                    <%#Eval("Address") %>
                                                </td>
                                                <td>
                                                    <%#Eval("StaffLevel") %>
                                                </td>
                                                <td>
                                                    <%#Eval("StaffType") %>
                                                </td>
                                                <td>
                                                    <%#Eval("UnitName")%>
                                                </td>
                                                <td style="text-align: center">
                                                    <input type="image" value='<%#Eval("StaffID")%>' src="images/i_edit.gif" title="Edit sale"
                                                        onclick="GetStaff(this.value); $('#checkAdd').val('edit'); showdialog(); return false;" />
                                                    &nbsp;&nbsp;
                                                    <input type="image" value='<%#Eval("StaffID")%>' src="images/i_delete.gif" title="Delete sale"
                                                        onclick="DeleteStaff(this.value, $('#<%=hdfTreeID.ClientID %>').val()); return false;" />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                </tbody>
                            </table>
                            <div class="dataTables_info" id="tSortable_info">
                                <asp:Literal ID="ltrInfo" runat="server" />
                            </div>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                </div>
            </div>
        </asp:Panel>
    </div>
    <div id="dialog-form" title="Staff information">
        <input type="hidden" name="staffId" id="staffId" />
        <input type="hidden" name="unitId" id="unitId" />
        <table border="0" width="100%" cellpadding="0" cellspacing="0" style="border-collapse: collapse;
            padding-right: 4px">
            <tr>
                <td>
                    Staff Code
                </td>
                <td colspan="2">
                    <input type="text" name="name" id="staffcode" />
                </td>
            </tr>
            <tr>
                <td>
                    Staff Name
                </td>
                <td colspan="2">
                    <input type="text" name="name" id="name" />
                </td>
            </tr>
            <tr>
                <td>
                    Address
                </td>
                <td colspan="2">
                    <textarea rows="2" name="address" id="address"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    Gender
                </td>
                <td colspan="2">
                    <select name="gender" id="gender">
                        <option value="true">Male</option>
                        <option value="false">Female</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    Level
                </td>
                <td colspan="2">
                    <select id="drdLevel">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    Type
                </td>
                <td colspan="2">
                    <asp:DropDownList ID="drdType" runat="server" AutoPostBack="false" />
                </td>
            </tr>
            <tr>
                <td>
                    Status
                </td>
                <td colspan="2">
                    <select id="drdStatus">
                        <option value="true">Actived</option>
                        <option value="false">Deactived</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    Phone number
                </td>
                <td>
                    <input type="text" name="phonenumber" id="phonenumber" onkeypress="return ValidateKeypress(/\d/,event);" />
                </td>
                <td style="width: 40px">
                    <input type="button" title="Added phone number" class="ui-button" id="btnAddedPhoneNumber"
                        style="margin: 0 0 8px 8px;" onclick="AddedPhoneNumber(this,'');" />
                </td>
            </tr>
            <tr>
                <td>
                    Unit
                </td>
                <td colspan="2">
                    <asp:DropDownList ID="ddlUnit" runat="server" AutoPostBack="false" />
                </td>
            </tr>
        </table>
        <div style="text-align: center;">
            <span style="color: Red" id="errorMessage"></span>
        </div>
    </div>
    <asp:UpdateProgress ID="udprogress" DisplayAfter="1" runat="server">
        <ProgressTemplate>
            <div class="ui-widget-overlay ui-front">
                <img src="images/loading.gif" alt="Loading..." style="position: fixed; top: 50%;
                    left: 50%" />
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <input type="hidden" id="checkfullinfo" value="" />
    <input type="hidden" id="formId" value="UnitManagement" />
</asp:Content>
